<template>
  <div class="dashboard-editor-container">

    <panel-group ref="panelgroup" @handleSetLineChartData="handleSetLineChartData" />

    <el-row style="background:#fff;padding:10px 10px 0;margin-bottom:32px;">
      <line-chart ref="lineChart" />
    </el-row>

  </div>
</template>

<script>
import PanelGroup from './dashboard/PanelGroup';
import LineChart from './dashboard/LineChart';
import PieChart from './dashboard/PieChart';
import BarChart from './dashboard/BarChart';
import GaugeChart from './dashboard/GaugeChart';
import { getInfo } from '@/api/workbench/home';

export default {
  name: 'Index',
  components: {
    PanelGroup,
    LineChart,
    PieChart,
    BarChart,
    GaugeChart
  },
  data() {
    return {
      // 遮罩层
      loading: true
    };
  },
  created() {
    this.getInfo();
  },
  methods: {
    handleSetLineChartData(type) {

    },
    getInfo() {
      this.loading = true;
      getInfo().then(response => {
        this.$refs.panelgroup.info(response.data);
        this.$refs.lineChart.info(response.data);
        this.loading = false;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
